﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Power.Models;
using Power.View;
using Power.View.Report;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;

namespace Power.ViewModel
{
    public class DataAnalysisViewModel: ViewModelBase
    {
        private DataAnalysis model;
        public DataAnalysisViewModel(DataAnalysis model)
        {
            this.model = model;
            Data = new DataAnalysisEntity()
            {
                BatchSelectList = Common.Common.GetBatchSelectList(),
                ReportSelectList = Common.Common.GetReportList(),
                MotherboadrSelectList = Common.Common.GetMotherboadrSelectList()
            };
            UserContent = OnTabSwitch(0);
        }

        #region 
        //同Title的子页面,需按照页面Table顺序加入集合中
        //后续页面请在此添加对应用户控件
        public UserControl OnTabSwitch(int index) {
            UserControl userControl= null;
            switch (index)
            {
                case 0:
                    userControl = new ComprehensiveTable();
                    break;
                case 1:
                    userControl = new AchievementTable();
                    break;
                case 2:
                    userControl = new MaintenanceSectionTable();
                    break;
                case 3:
                    userControl = new CheckTable();
                    break;
                case 4:
                    userControl = new ClassificationWorkLoadTable();
                    break;
                case 5:
                    userControl = new PointWorkLoadTable();
                    break;
                case 6:
                    userControl = new SectionWorkLoadTable();
                    break;
                case 7:
                    userControl = new DefectTypeTable();
                    break;
                case 8:
                    userControl = new DefectTypeCharts();
                    break;
                case 9:
                    userControl = new DefectLevelTable();
                    break;
                case 10:
                    userControl = new DefectLevelCharts();
                    break;
                case 11:
                    userControl = new DefectSectionTable();
                    break;
                case 12:
                    userControl = new DefectDensityCharts();
                    break;
                default:
                    break;
            }
            return userControl;
        }

        private UserControl userControl;

        public UserControl UserContent
        {
            get => userControl;
            set
            {
                userControl = value;
                RaisePropertyChanged();
            }
        }

        #endregion

        #region 数据绑定

        public DataAnalysisEntity Data { get; private set; }
        #endregion
    }
}
